<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    @include('public.h5_head')
    <title>全部订单</title>
    <script src="{{ env('CDN_DOMAIN_NAME') }}/js/commonjs/rem.js"></script>
    <link rel="stylesheet" type="text/css" href="{{ env('CDN_DOMAIN_NAME') }}/css/commoncss/common.css"/>
    <link rel="stylesheet" type="text/css" href="{{ env('CDN_DOMAIN_NAME') }}/css/done.css"/>
	<style>
		.pay_mask{width:100%;height:100%;position:absolute;top:0;left:0;z-index:1000;background:#000;}
		.pay_mask2{opacity:0.4;filter:alpha(opacity=40)}

		.pay_over{width:11.52rem;min-height:4.48rem;text-align:center;color:#383838;background:#F7F7F7;-moz-border-radius: 0.555rem;-webkit-border-radius: 0.555rem;border-radius: 0.555rem;font-size:0.725rem;position: absolute;top:10rem;left:2.24rem;z-index:2000;}
		.pay_over .pay_pass{padding-bottom: 1rem;min-height:2.56rem;line-height:2.56rem;border-bottom:1px solid #ccc;box-sizing:border-box;}
		.pay_over .pay_ok{height:1.92rem;line-height:1.92rem;color:#3A79FF;}

		.pay_over .pay_pass p{font-size:0.725rem;margin-bottom:0.2rem;width:100%;height:1rem;}
		.pay_over .pay_pass p span{margin-right:0.5rem;}
	</style>
</head>
<script src="{{ env('CDN_DOMAIN_NAME') }}/js/commonjs/iscroll.js"></script>
<script src="{{ env('CDN_DOMAIN_NAME') }}/js/app.js"></script>
<body onload="loaded()">
<div id="box_done">
    <div class="wrap">
        <div class="main_done">
			<div class="seek" onclick="window.location.href='/user/selectOrders'">
				<div class="seek_img">
					<img class="seek_pic" src="/img/seek.png" alt="">
					<p class="seek_name">搜索</p>
				</div>
			</div>
            @if(count($datas) == 0)
            <div class="main_empty">
                <div class="done_empty">
                    <div class="done_img">
                        <img src="/img/00013.png" alt="" />
                    </div>
                </div>
                <p class="done_wrods">还没有订单哦!</p>
            </div>
            @else
            @foreach($datas as $data)
					<div class="done_product">
						<div class="done_title">
							<div class="done_icon">
								<img src="/img/00004.png" alt="" />
								<span>{{ $brands[$data->brand] }}</span>
								<div class="done_success">
									@if(  in_array($data->status,[0,1]))
										待支付
									@elseif($data->status == 3)
									待发货
									@elseif($data->status == 2)
									交易关闭
									@elseif($data->status == -1)
									支付失败
									@elseif($data->status == -2)
									订单失效
									@elseif($data->status == -9)
									订单超时
									@elseif($data->status == 5)
									已完成
									@elseif($data->status == -3)
									已退款
									@elseif($data->status == 6)
									线下支付成功
									@elseif($data->status == 7)
										待收货
									@endif
								</div>
							</div>
							<div class="done_code"><span>订单编号：</span>{{ $data->ordernum }}</div>
						</div>
						<div class="done_list" onclick="window.location.href='/produc?good_id={{ $data->pro_id }}'">
							<div class="done_list_l">
								<img src="{{ env('CDN_DOMAIN_NAME') }}/upload/{{ $data->face }}" alt="" class="done_list_img" />
							</div>
							<div class="done_list_r">
								<div class="done_list_name">
									<p class="done_list_tit">{{ $data->title }}</p>
									<p class="done_price">￥<b>{{sprintf("%.2f", $data->total_price/$data->num) }}</b></p>
								</div>
								<p class="done_list_words">款号：{{ $data->girard }}</p>
								<div class="done_list_color">
									<p class="done_list_hue">颜色：{{ $data->color }}</p>
									<p class="done_list_post">邮费：￥{{ sprintf("%.2f",$data->postage_estimate) }}</p>
								</div>
								<div class="done_list_b">
									@if($data->pre_sale == 1)
										<p class="done_list_postage">数量：{{ $data->num }}件</p>
										<a href="javascript:;" class="deTa" style="float:left;width:2rem;text-align:end;" abc="{{$data->id}}">详情</a>
									@else
										<p class="done_list_postage">数量：{{ $data->num }}手</p>
									@endif
									<p class="done_sum">合计：<i>￥{{sprintf("%.2f", $data->total_price + $data->postage_estimate) }}</i></p>
								</div>
							</div>
						</div>
						<div class="done_btn">
							<span class="agency">代理：{{ $companys[$data->company_id] }}</span>
						</div>
					</div>
            @endforeach
            @endif
            <!--添加-->
        </div>
    </div>
	<div class="pay_mask2 pay_mask" style="display:none;"></div>
	<div class="pay_over" style="display:none;">
		<div class="pay_pass"></div>
		<div class="pay_ok">确定</div>
	</div>
</div>
</body>
<script>
	/*滚动*/
	var myScroll;
	function loaded () {
		setTimeout(function(){
			myScroll = new IScroll('.wrap', {
				mouseWheel: true,
				click: true
			});
		},100);
	}
	document.addEventListener('touchmove', function (e) {e.preventDefault();},false);

    $(".deTa").bind('click', function(event) {

//        $(document).on("click",".deTa",function(event){
        event.stopPropagation();
        var id=$(this).attr("abc");
        $.ajax({
            headers: {'X-CSRF-TOKEN': $('meta[name="csrf_token"]').attr('content')},
            url: '/fetch-sale-order-info/'+id,
            data: {},
            type: 'get',
            dataType: 'json',
            success: function (data) {
                if (data.result.success) {
                    $(".pay_pass").empty();
                    var res=data.content;
                    var str='';
                    for(var k in res){
                        str=str+'<p><span>'+res[k].girard+'</span><span>'+res[k].color+'</span><span>'+res[k].size+'码</span><span>'+res[k].num+'件</span></p>';
                    }
                    $(".pay_pass").append(str);
                    $(".pay_over").show();
                    $(".pay_mask2").show();
                } else {
                    $(".faceImg").attr("src", "/img/weep.png");
                    $(".oHandle").text(data.result.errorMsg);
                    $(".oSuccess").show(0).delay(1000).hide(0);
                }
            }
        })

    });
    $(".pay_ok").click(function(){
        $(".pay_over").hide();
        $(".pay_mask2").hide();
    })
</script>
</html>
